package com.datastructure.test.multiofarray;

public class MultiOfArray {

    public static void main(String[] args) {
       int[][] a = {{1}};
       int[][] b = {{1}};
       MultiOfArray multiOfArray = new MultiOfArray();
        int[][] solve = multiOfArray.solve(a, b);
        System.out.println(solve);
    }

    public int[][] solve (int[][] a, int[][] b) {
        // write code here
        int length = a.length;
        int[][] result = new int[length][length];
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < length; j++) {
                result[i][j]=compute(i,j,a,b,length);
            }
        }
        return result;
    }

    private int compute(int i, int j, int[][] a, int[][] b,int length) {
        int sum = 0;
        for (int k = 0; k < length; k++) {
            sum+=(a[i][k]*b[k][j]);
        }
        return sum;
    }
}
